<?php $this->layout = 'admin'; ?>
<html>
    <body>
        <?php if ($admin == 1) { ?>


            <?php $this->start('leftmenu'); ?>
        <div class="well pull-left">
            <ul class="nav nav-list">
                <li><?php echo $this->Html->link('Manage Accounts', array('controller' => 'tattlraccounts', 'action' => 'index')); ?></li>
                <li><a href="/tattlraccounts/addaccount">Add Account</a></li>
                <li><?php echo $this->Html->link('Assign Positions', array('controller' => 'Accounts', 'action' => 'assign_pos')); ?></li>
            </ul>
        </div>
            <?php $this->end(); ?>

            <table>
                <tr>
                    <th>Name</th>
                    <th>Actions</th>

                    <?php for ($i = 0; $i < $l; $i++) { ?>
                    <tr>

                        <td width="30"><?php echo $this->Html->image($images[$i]) . ' &nbsp;&nbsp;  ' . $accountsArray[$i]['Accounts']['name'] ?></td>
                        <td width="20"><?php echo $this->Html->link('Delete', array('action' => 'delete1', $accountsArray[$i]['Accounts']['accID']),array(),"Are you sure you want to delete this account ?") ?>
                            <?php
                            echo $this->Html->link('Edit', array('controller' => 'accounts', 'action' => 'edit', $accountsArray[$i]['Accounts']['accID']))
                            . " " . $this->Html->link('Reactivate', array('controller' => 'tattlraccounts', 'action' => 'reactivate', $accountsArray[$i]['Accounts']['accID'])) . " ";
                            if (isset($account)) {
                                if ($account == $accountsArray[$i]['Accounts']['accID']) {
                                    echo $this->Html->link($limit, array('controller' => 'tattlraccounts', 'action' => 'checkLimit', $accountsArray[$i]['Accounts']['accID']));
                                } else {
                                    echo $this->Html->link('Check Limit', array('controller' => 'tattlraccounts', 'action' => 'checkLimit', $accountsArray[$i]['Accounts']['accID']));
                                }
                            } else {
                                echo $this->Html->link('Check Limit', array('controller' => 'tattlraccounts', 'action' => 'checkLimit', $accountsArray[$i]['Accounts']['accID']));
                            }
                            ?></td>
                    
                    </tr>
                    <?php } ?>

            </table>


        <?php } ?>

    </body>
</html>
